package com.junzhiit.nengji.model.enums;

import com.bainaeco.framework.exception.InvalidArgumentException;

public enum UserVipType {
	
	CONSUMPTION(0,"消费"),
	BUY(1,"购买"),
	PRESENT(2,"赠送");
	
	private Integer type;
	
	private String value;

	private UserVipType(Integer status,String value){
		this.type = status;
		this.value = value;
	}

	public int toIntType() {
		return this.type;
	}
	
	public String toStringValue() {
		return this.value;
	}

	public static UserVipType toFlag(int type) {
		if (CONSUMPTION.type == type) {
			return CONSUMPTION;
		} else if (BUY.type == type) {
			return BUY;
		} else if (PRESENT.type == type) {
			return PRESENT;
		} else {
			throw new InvalidArgumentException("Unknown UserVipType[" + type + "].");
		}
	}
}
